<div>
<?php 
	echo $this->Html->script(array('visualize.jQuery'));
	echo $this->Html->css(array('visualize', 'visualize-light')); 
	echo $this->Html->scriptBlock('
		$(document).ready(function() {
			$("#OrdemservicosServicoOrdemservicoId").setMask({mask: "9", type: "repeat"}).css("text-align", "right");
			$("#tabela").visualize({type: "bar"});
	  	});
	', array('inline' => true));
	if( $msg ) 
			echo '<script type="text/javascript">alert("'.$msg.'");</script>'; 
?>
	<div class="titulo_pagina">
		<p> RELATÓRIO ESTATÍSTICO OS POR SERVIÇO </p>
	</div>
	<?php 
		echo $this->Form->create(null, array('url' => array('controller' => 'ordemservicosServicos', 'action' => 'relatorioServicosPdf')));
		echo 'PERÍODO DE';
		echo $this->Form->input('datainicial', array('label' =>false));
		echo 'A';
		echo $this->Form->input('datafinal', array('label' =>false));
		echo '<br>';
		echo 'TIPO';
		echo $this->Form->input('garantia', array('label' => 'Garantia', 'type' => 'checkbox'));
		echo $this->Form->input('orcamento', array('label' => 'Orçamento', 'type' => 'checkbox'));
		
		echo $ajax->datepicker('OrdemservicosServicoDatainicial');
		echo $ajax->datepicker('OrdemservicosServicoDatafinal');
		
		echo $ajax->submit('OK', array('url'=> array('controller'=>'ordemservicosServicos', 'action'=>'relatorioServicos'), 'update' => 'inicial'));
		//echo $this->Js->submit('Ok', array('div' => false, 'update' => '#inicial'));
		echo $this->Form->end('Imprimir Relatório');
		echo $this->Js->writeBuffer();
	?>
</div>
<table>
  <tr>
    <th align="center" width="30%">QNT. OS</th>
    <th align="center" width="70%">SERVIÇO</th>
  </tr>
  <?php
	$i = 0;
	foreach ($servicos as $servico):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		} 
	?>
	<tr<?php echo $class;?>>
		<td align="center" width="30%"><?php echo $servico['quantidadeOs']; ?></td>
		<td align="center" width="70%"><?php echo $servico['descricao']; ?></td>
	</tr>
<?php endforeach; ?>
</table>
<table id="tabela" style="display: none">
	<thead>
		<tr>
			<td></td>
			<?php foreach ($servicos as $servico) { ?>
				<th scope="col"><?php echo $servico['descricao']; ?></th>
			<?php } ?>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th scope="col">ATRASADO</th>
			<?php foreach ($servicos as $servico) { ?>
				<td><?php echo $servico['porcentagemAtr']; ?></td>
			<?php } ?>
		</tr>
		<tr>
			<th scope="col">EM DIA</th>
			<?php foreach ($servicos as $servico) { ?>
				<td><?php echo $servico['porcentagemDia']; ?></td>
			<?php } ?>
		</tr>
		<!--<tr>
			<th scope="col">EXPIRANDO</th>
			<?php //foreach ($servicos as $servico) { ?>
				<td><?php //echo $servico['porcentagemExp']; ?></td>
			<?php //} ?>
		</tr>
		-->
	</tbody>
</table>